public class Test {
    public static int  fun(int[] array){

        try{
          System.out.println(array[10]);//存在数组越界异常
              return 10;
        }catch(ArithmeticException e){//捕获算数异常
           e.printStackTrace();
            System.out.println("算数异常");
        } catch (ArrayIndexOutOfBoundsException e){
            e.printStackTrace();
            System.out.println("数组越界异常");
            return 20;
        } finally{
            System.out.println("finally被执行了");
            return 100;
        }

    }
    public static void main(String[] args) {
        int[] array={1,2,3,4,5};
        int result=fun(array);
        System.out.println("result="+result);
    }
}
